#ifndef __INVERTEDINDEX_HPP__
#define __INVERTEDINDEX_HPP__

#include <vector>
#include <map>
#include <unordered_map>
#include <utility>
#include "PageLib.hpp"
#include "TF_IDF.hpp"

using std::vector;
using std::map;
using std::pair;
using std::string;
using std::unordered_map;

class InvertedIndex
{
public:
    InvertedIndex(const PageLib & pagelib, Deduplication & wordseg, TF_IDF & tfidf);
    ~InvertedIndex();
    void create_wordmap();
    void create_invertedTable();
    void store();


private:
    vector<processedFile> _ripepage;
    map<int,pair<int, int>> _offset;
    map<string,string> _confMap;
    unordered_map<string, map<int,long double>> _invertedTable;
    Deduplication & _wordseg;
    //unordered_map<string, int> _DFmap;
    unordered_map<string, map<int, int>> _wordmap;
    TF_IDF & _tfidf;
    map<int,int> _wordnum;
};


#endif
